package com.khactho.beginningandroidgame;

import android.app.ListActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class AndroidBasicsStarter extends ListActivity {

	String tests[] = {"LifeCycleTest", "SingleTouchTest", "MultiTouchTest"};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.activity_android_basics_starter);
		setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_expandable_list_item_1 ,tests));
	}
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id )
	{
		super.onListItemClick(l, v, position, id);
		String testName = tests[position];
		try
		{
			Class clazz = Class.forName("com.khactho.beginningandroidgame."+testName);
			Intent intent = new Intent(this, clazz);
			startActivity(intent);
		}catch(ClassNotFoundException e){e.printStackTrace();}
	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu)
	{
		getMenuInflater().inflate(R.menu.android_basics_starter, menu);
		return true;
	}
}
